package com.zhangj.alljuc.juc;

import lombok.Getter;

/**
 * @InterfaceName NationEnum
 * @Description
 * @Author zhangjie
 * @Date 2022/3/7 11:35
 * @Version 1.0
 */

public enum NationEnum {
    ONE(1, "齐国"),
    TWO(2, "楚国"),
    THREE(3, "韩国"),
    FOUR(4, "燕国"),
    FIVE(5, "赵国"),
    SIX(6, "魏国"),
    SEVEN(7, "秦国");



    @Getter
    private Integer nationCode;

    @Getter
    private String nationName;

    NationEnum(Integer nationCode, String nationName) {
        this.nationCode = nationCode;
        this.nationName = nationName;
    }

    public static NationEnum forEach(int code){
        NationEnum[] nationEnums = NationEnum.values();

        for (NationEnum nationEnum : nationEnums) {
            if (nationEnum.nationCode == code) {
                return nationEnum;
            }
        }
        return null;
    }
}
